<{include file="section/header.tpl"}>
<form action='/task/handle' method="post" name="frm" id="frm">
<input type="hidden" name="action_id" id="action_id" value="" />
<input type="hidden" name="task_id" id="task_id" value="" />
<input type="hidden" name="reason_ee" id="reason_ee" value="" />
<table>
<tr><td>任务号</td><td>角色</td><td>开始时间</td><td>动作</td></tr>
<{foreach from=$datas item=data}>
<tr>
	<td><{$data.task_id}></td>
	<td><{$data.role}></td>
	<td><{$data.start_time}></td>
	<td>
	<{foreach from=$data.action item=act}>
		<input type="button" name="<{$act.action_id}>" value="<{$act.action_name}>" onclick="submit_task(<{$data.task_id}>,<{$act.action_id}>)" />
	<{/foreach}>
	</td>
</tr>
<{/foreach}>
<div id="reason_id" style="display:none;">
<textarea name="reason" id="reason" cols="35" rows="5"> </textarea>
</div>
</form>
<script>
function submit_task(task_id, action_id)
{

	if(!task_id || !action_id)
	{
		alert('参数错误');

		return false;
	}

	var is_show	= document.getElementById("reason_id").style.display;
	
	if(is_show == 'none')
		document.getElementById("reason_id").style.display = 'block';
	else
		document.getElementById("reason_id").style.display = 'none';

	var reason1	=  document.getElementById("reason").value;

	if(reason1){

		//var reason	= document.getElementById('reason').value;

		//alert(reason1);

		document.getElementById('task_id').value = task_id;	
		
		document.getElementById('action_id').value = action_id;	
		
		document.getElementById('reason_ee').value = reason1;

		document.getElementById('frm').submit();

	}else{

		alert('请填写理由');
	
		return false;
	}

}
</script>
<{include file="section/footer.tpl"}>
